﻿namespace PowerSong.UserInterface
    {
    using System;
    using System.Windows;

    /// <summary>
    /// Interaction logic for CreateDatabaseWindow.xaml
    /// </summary>
    public partial class CreateDatabaseWindow : Window
        {

        public string FileName
            {
            get { return DatabaseSaveFileControl.FileName; }
            set { DatabaseSaveFileControl.FileName = value; }
            }

        public bool OptionRecordUsage
            {
            get { return RecordSongUsageCheckBox.IsChecked == true; }
            }

        public bool OptionDownloadSongs
            {
            get { return DownloadSongsCheckBox.IsChecked == true; }
            }

        public bool OptionDownloadStyles
            {
            get { return DownloadStylesCheckBox.IsChecked == true; }
            }
        
        public CreateDatabaseWindow()
            {
            InitializeComponent();
            }

        private void CancelButton_Click(object sender, RoutedEventArgs e)
            {
            this.DialogResult = false;
            }

        private void OKButton_Click(object sender, RoutedEventArgs e)
            {

            try
                {

                // Ensure the file name of the database has been specified
                if (string.IsNullOrEmpty(FileName.Trim())) throw new Exception("Please specify the file name for your new PowerSong database.");

                // Close the window
                this.DialogResult = true;

                }
            catch (Exception ex)
                {
                MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                }

            }

        }

    }
